<?php
namespace App\Modules\User;

use App\Library\Rank\AbstractSingleRank;
use App\Modules\Order\Models\RewardRecord;
use App\Modules\User\Models\User;

class ReferrerRank extends AbstractSingleRank
{

    public static function refresh()
    {
        self::multi(function () {
            static::flush();
            User::query()
                ->orderBy('user_id')
                ->each(function ($item) {
                    static::update($item->id, $item->count);
                });
        });
    }
}
